﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Reflection;
using Arch.Intercep;

namespace Arch.Aspects
{
    [AttributeUsage(AttributeTargets.Method)]
    public class AspectBehaviorAttribute : Attribute, IMemberAspectInterceptor
    {
        public AspectBehaviorAttribute(ActionTarget targets)
        {
            Targets = targets;
        }

        public virtual ActionTarget Targets { get; protected set; }

        public void Intercept(object entity, MemberInfo member)
        {
            if (member is MethodInfo)
            (member as MethodInfo).Invoke(entity, new object[0]);
        }
    }
}
